import javax.sound.sampled.AudioSystem;
import javax.sound.sampled.AudioInputStream;
import javax.sound.sampled.AudioFormat;
import javax.sound.sampled.SourceDataLine;
import javax.sound.sampled.DataLine;
import java.io.File;

public class mp3Player
{

    private static final int BUFFER_SIZE = 176400; // 44100 x 16 x 2 / 8

    public static void main(String[] args) throws Exception
    {
	byte[] buffer = new byte[BUFFER_SIZE];

	AudioInputStream in = AudioSystem.getAudioInputStream(
		AudioFormat.Encoding.PCM_SIGNED,
		AudioSystem.getAudioInputStream(new File("LionKing.mp3")));
	AudioFormat audioFormat = in.getFormat();

	SourceDataLine line = (SourceDataLine) AudioSystem
		.getLine(new DataLine.Info(SourceDataLine.class, audioFormat));
	line.open(audioFormat);
	line.start();

	while (true)
	{
	    int n = in.read(buffer, 0, buffer.length);
	    if (n < 0)
	    {
		break;
	    }
	    line.write(buffer, 0, n);
	}
	line.drain();
	line.close();
    }
}